
<%@ page import="kioscodeal.Pedido" %>
<!DOCTYPE html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'pedido.label', default: 'Pedido')}" />
		<title><g:message code="default.list.label" args="[entityName]" /></title>
	</head>
	<body>
		<div id="list-pedido" class="content scaffold-list" role="main">
			<div class="panel panel-primary">
				<div class="panel-heading">
					<h3 class="panel-title"><i class="fa fa-long-arrow-right"></i> <g:message code="default.list.label" args="[entityName]" /></h3>
				</div>
				<div class="panel-body">
					<div class="row">
						<div class="col-lg-12">
								<g:if test="${flash.message}">
									<div class="message" role="status">${flash.message}</div>
								</g:if>
								<g:if test="${pedidoInstanceList}">
									<div class="table-responsive">
										<table class="table table-bordered table-hover tablesorter">
										<thead>
											<tr>
											
												<g:sortableColumn class="text-center" property="cliente" title="${message(code: 'pedido.cliente.label', default: 'Cliente')}" />
				
												<g:sortableColumn class="text-center" property="estadoPedido" title="${message(code: 'pedido.estadoPedido.label', default: 'Estado Pedido')}" />
				
												<g:sortableColumn class="text-center" property="calificacionPedido" title="${message(code: 'pedido.calificacionPedido.label', default: 'Calificacion Pedido')}" />																
				
												<g:sortableColumn class="text-center" property="importeTotal" title="${message(code: 'pedido.importeTotal.label', default: 'Importe Total')}" />
				
												<g:sortableColumn class="text-center" property="distanciaComercioCliente" title="${message(code: 'pedido.distanciaComercioCliente.label', default: 'Distancia Comercio Cliente')}" />
				
												<g:sortableColumn class="text-center" property="opciones" title="Opciones" />
				
											</tr>
										</thead>
										<tbody>
										<g:each in="${pedidoInstanceList}" status="i" var="pedidoInstance">
											<tr class="${(i % 2) == 0 ? 'even' : 'odd'} text-center">
											
												<td>
													<g:if test="${session?.user?.role?.value == 'admin'}">
														<g:link action="show" id="${pedidoInstance.id}">${fieldValue(bean: pedidoInstance, field: "cliente.login")}</g:link>
													</g:if>
													<g:if test="${session?.user?.role?.value == 'user'}">
														${fieldValue(bean: pedidoInstance, field: "cliente.login")}
													</g:if>
												</td>												
												
												<td>${fieldValue(bean: pedidoInstance, field: "estadoPedido.value")}</td>
				
												<td>${fieldValue(bean: pedidoInstance, field: "calificacionPedido.value")}</td>														
				
												<td>${fieldValue(bean: pedidoInstance, field: "importeTotal")}</td>
				
												<td>${fieldValue(bean: pedidoInstance, field: "distanciaComercioCliente")}</td>
				
												<td>
													<g:if test="${session?.user?.role?.value == 'admin'}">
														<g:form url="[resource:pedidoInstance, action:'delete']" method="DELETE">
														<fieldset class="buttons">
																<i class="fa fa-edit"></i><g:link class="edit" action="edit" resource="${pedidoInstance}"><g:message code="default.button.edit.label" default="Edit" /></g:link>
																<g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Esta seguro?')}');" />
														</fieldset>
													</g:form>
													</g:if>													
													<g:if test="${session?.user?.role?.value == 'user'}">
														<g:form url="[resource:pedidoInstance, action:'delete']" method="DELETE">
														<fieldset class="buttons">
																<i class="fa fa-edit"></i><g:link class="edit" action="edit" resource="${pedidoInstance}">Ver</g:link>																
														</fieldset>
													</g:form>
													</g:if>																
												</td>				
											</tr>
										</g:each>
										</tbody>
									</table>
								</div>
							</g:if>
							<g:else>
								No existen Pedidos dados de alta.
							</g:else>
						</div>
					</div>
				</div>
				<div>
					<div class="pagination">
						<g:paginate total="${pedidoInstanceCount ?: 0}" />
					</div>
				</div>
				<div class="nav" role="navigation">
					<div class="row">
						<div class="col-lg-3">
						</div>
						<div class="col-lg-3">
							<a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a>
						</div>
						<div class="col-lg-3">							
							<g:link class="create" action="compra"><g:message code="default.new.label" args="[entityName]" /></g:link>
						</div>
						<div class="col-lg-3">
						</div>
					</div>					
				</div>
			</div>
		</div>
	</body>
</html>
